home *** CD-ROM | disk | FTP | other *** search
- /*
- NINetInfo.h
- Abstraction of the NetInfo administrative information system
- Copyright (c) 1994, NeXT Computer, Inc.
- All rights reserved.
- */
-
- #ifndef STRICT_OPENSTEP
-
- /*
- * Common declarations for all NetInfo access classes.
- */
- #define NIDefaultReadTimeout 30
- #define NIDefaultWriteTimeout 30
-
- enum NIStatus {
- NIOperationSucceeded = 0,
- NIInvalidDirectory = 1,
- NIStaleDirectory = 2,
- NINoSpace = 3,
- NIPermissionDenied = 4,
- NINoSubdirectories = 5,
- NIInvalidProperty = 6,
- NIInvalidValue = 7,
- NIDirectoryHasSubdirectories = 8,
- NINotASubdirectory = 9,
- NISerializationError = 10,
- NIRootDomain = 11,
- NICantContactParent = 12,
- NIReadOnlyDatabase = 13,
- NISystemError = 14,
- NICantRegenerate = 15,
- NIInvalidOperationOnClone = 16,
- NICantFindAddress = 17,
- NIDuplicateTag = 18,
- NINoTag = 19,
- NIAuthenticationError = 20,
- NIInvalidUser = 21,
- NIMasterServerIsBusy = 22,
- NIInvalidDomain = 23,
- NIInvalidOperationOnMaster = 24,
- NICommunicationFailure = 9999,
- };
- typedef enum NIStatus NIStatus;
-
- enum NIServerInfoIndex {
- NIServerInfoHostNameIndex = 0,
- NIServerInfoAddressIndex = 1,
- NIServerInfoTagIndex = 2,
- NIServerInfoDomainNameIndex = 3,
- };
-
- #import <Foundation/NSDate.h>
- #import <Foundation/NSLock.h>
- #import <Foundation/NSArray.h>
- #import <Foundation/NSString.h>
- #import <Foundation/NSBundle.h>
- @class NIDirectory;
- @class NIDomain;
-
- @interface NINetInfo : NSObject <NSLocking>
- {
- @private
- NSTimeInterval defaultReadTimeout;
- NSTimeInterval defaultWriteTimeout;
- NSLock *netinfoLock;
- NSBundle *niBundle;
- BOOL _didInit;
- BOOL niLog;
- BOOL useThreadLock;
- id reserved;
- }
-
- /*
- * Get the shared NINetInfo instance.
- * equivalent to [[NINetInfo alloc] init]
- */
- + (NINetInfo *)netinfo;
-
- /*
- * A dictionary containing information on the status of the last
- * NetInfo transaction. Returns nil if the last transaction did
- * not generate an error.
- *
- * Each thread has it's own status dictionary.
- * The dictionary contains NSStrings for keys. The keys are:
- *
- * status - (NSNumber *) NIStatus of the last operation
- * message - (NSString *) Localized string description of the status code
- * sender - (NSString *) description of the caller
- * operation - (NSString *) the operation performed
- * domain - (NSString *) description of the domain
- * directory - (NSString *) description of the directory
- * key - (NSString *) description of the key
- * value - (NSString *) description of the value
- */
- - (NSDictionary *)statusDictionary;
-
- /*
- * Get the NIStatus from the last NetInfo transaction. Same as the status
- * in the statusDictionary.
- */
- - (NIStatus)netinfoStatus;
-
- /*
- * If enabled, the logging facility will log information about every
- * NetInfo transaction. Produces a lot ouf output! Useful for debugging.
- */
- - (void)enableLogging:(BOOL)flag;
- - (BOOL)isLoggingEnabled;
-
- /*
- * Locking facility to limit NetInfo RPC transtations to one thread at a
- * time. This is needed since NEXTSTEP's RPC is not thread safe.
- * The default value is NO (for single-threaded programs).
- */
- - (void)setEnableThreadLock:(BOOL)flag;
- - (BOOL)isThreadLockEnabled;
-
- /*
- * Get a string describing a status code.
- */
- - (NSString *)errorMessage:(NIStatus)status;
-
- /*
- * Default read and write timeouts for NIDomain and NIServer connections.
- */
- - (void)setDefaultReadTimeout:(NSTimeInterval)time;
- - (NSTimeInterval)defaultReadTimeout;
- - (void)setDefaultWriteTimeout:(NSTimeInterval)time;
- - (NSTimeInterval)defaultWriteTimeout;
-
- /*
- * Search for directories in the domain hierarchy
- *
- * firstDirectoryWithPath: starts at the local domain and returns the
- * first directory found in a hierarchical lookup.
- *
- * firstDirectoryWithPath:startingDomain: does the same, starting at the
- * given directory.
- *
- * lookupDirectoriesWithPath: (and lookupDirectoriesWithPath:startingDomain:)
- * return all directories with the given path between the local domain
- * (startingDomain) and the root domain.
- *
- * allDirectoriesWithPath: returns all directories with the given path in
- * the local domain hierarchy. Warning: this is very slow.
- *
- * allDirectoriesWithPath:inHierarchyWithDomain: returns all directories with
- * the given path in the domain hierarchy that includes the given domain.
- * Warning: this is very slow.
- */
- - (NIDirectory *)firstDirectoryWithPath:(NSString *)path;
- - (NIDirectory *)firstDirectoryWithPath:(NSString *)path
- startingDomain:(NIDomain *)domain;
-
- - (NSArray *)lookupDirectoriesWithPath:(NSString *)path;
- - (NSArray *)lookupDirectoriesWithPath:(NSString *)path
- startingDomain:(NIDomain *)domain;
-
- - (NSArray *)allDirectoriesWithPath:(NSString *)path;
- - (NSArray *)allDirectoriesWithPath:(NSString *)path
- inHierarchyWithDomain:(NIDomain *)domain;
-
- @end
-
- #endif STRICT_OPENSTEP
-